package com.parenting.controller;


import com.parenting.model.IMPage;
import com.parenting.oauth2.config.AuthUtil;
import com.parenting.request.NoReplyRequest;
import com.parenting.request.ShopEvaluateListRequest;
import com.parenting.response.EvaluationListResponse;
import com.parenting.response.NoReplyResponse;
import com.parenting.service.EvaluationService;
import com.parenting.util.base.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 店铺评价 前端控制器
 * </p>
 *
 * @author 烟台业达-王世玺
 * @since 2021-09-27
 */
@RestController
@RequestMapping("/evaluation")
@Api(tags = "评价管理")
public class EvaluationController {

    @Autowired
    private EvaluationService evaluationService;

    @ApiOperation("店铺评价列表")
    @PostMapping("page/list")
    public Result<IMPage<EvaluationListResponse>> getEvaluationListResponse(@RequestBody ShopEvaluateListRequest request){

        IMPage<EvaluationListResponse> evaluationListResponse = evaluationService.getEvaluationListResponse(request, AuthUtil.getUserInfo().getShopId());
        return Result.buildSuccess(evaluationListResponse);

    }

    @ApiOperation("未回复列表")
    @PostMapping("reply/list")
    public Result<IMPage<NoReplyResponse>> getNoReplyResponseList(@RequestBody NoReplyRequest oReplyRequest){
        IMPage<NoReplyResponse> noReplyResponseList = evaluationService.getNoReplyResponseList(oReplyRequest.getPage(), AuthUtil.getUserInfo().getShopId());
        return Result.buildSuccess(noReplyResponseList);
    }
}

